<template>
  <ul ref="pannel" class="goods-list-top" v-if="list.length">
        <li v-for="item in list" :key="item.id">
          <RouterLink to="/">
            <img v-imgLazy="item.picture" :src="gif" alt="" />
            <template v-if="isNew">
              <p class="name">{{ item.name }}</p>
              <p class="price">&yen;{{ item.price }}</p>
            </template>
            <template v-if="!isNew">
              <p class="name">{{item.title}}</p>
              <p class="desc">{{item.alt}}</p>
            </template>
          </RouterLink>
        </li>
  </ul>
  <ul class="goods-list-top" v-else>
    <li v-for="i in 4" :key="i">
      <p><XtxSkeleton width="306" height="306" bgColor="#eee"/></p>
      <p><XtxSkeleton width="306" height="32" bgColor="#eee"/></p>
      <p><XtxSkeleton width="306" height="32" bgColor="#eee"/></p>
    </li>
  </ul>
</template>
<script>
export default {
  name: 'GoodsList',
  props: {
    list: {
      type: Array,
      default: () => []
    },
    isNew: {
      type: Boolean,
      default: true
    }
  }
}
</script>
<style scoped lang="less">
.goods-list-top {
  display: flex;
  justify-content: space-between;
  height: 406px;
  li {
    width: 306px;
    height: 406px;
    background: #f0f9f4;
    // 激活效果
    transition: all 0.5s;
    &:hover {
      transform: translate3d(0, -6px, 0);
      box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
    }
    // end
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 22px;
      padding-top: 12px;
      text-align: center;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
    }
    .price {
      color: @priceColor;
    }
    .desc {
      color: #999;
      font-size: 18px;
    }
  }
}
</style>
